<!DOCTYPE html>
<html lang="en">
	<head>
		<title>three.js webgl - lights - rect area light</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<style>
			body {
				background-color: #000;
				margin: 0px;
				overflow: hidden;
			}

			#info {
				position: absolute;
				top: 0px; width: 100%;
				color: #ffffff;
				padding: 5px;
				font-family: Monospace;
				font-size: 13px;
				text-align: center;
			}

			a {
				color: #ff0080;
				text-decoration: none;
			}

			a:hover {
				color: #0080ff;
			}
		</style>
	</head>
	<body>

		<div id="container"></div>
		<script src="three.js"></script>
		<script src="js/controls/OrbitControls.js"></script>
		<script>
			var container = document.getElementById( 'container' );
			var renderer = new THREE.WebGLRenderer( { antialias: true } );
			var camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 1000 );
			var controls = new THREE.OrbitControls( camera, renderer.domElement );
			var scene = new THREE.Scene();
			var matStdParams = {
				roughness: 0.044676705160855, // calculated from shininess = 1000
				metalness: 0.0
			};
			var matStdFloor = new THREE.MeshStandardMaterial( matStdParams );
// 			var matStdObjects = new THREE.MeshStandardMaterial( matStdParams );
// 			var matStdFloor = new THREE.MeshBasicMaterial({color: "#ff0000",transparent:true,blending:THREE.AdditiveBlending})
// 			var matStdObjects = new THREE.MeshBasicMaterial({color: "#ff0000",transparent:true,blending:THREE.AdditiveBlending})
			var geoFloor = new THREE.BoxGeometry(120, 1, 120 );
// 			var geoBox = new THREE.BoxGeometry( Math.PI, Math.sqrt( 2 ), Math.E );
			var mshStdFloor = new THREE.Mesh( geoFloor, matStdFloor );
// 			var mshStdBox = new THREE.Mesh( geoBox, matStdObjects );
			var rectLight;
			init();
			animate();
			function init() {
				camera.position.set( 0, 20, 35 );
				rectLight = new THREE.RectAreaLight( 0xffffff, 500, 100, 10 );
				rectLight.position.set( 0, 0, -5 );
				scene.add( rectLight );
				
				
				scene.add( camera );
				matStdFloor.color.set( 0x808080 );
// 				matStdObjects.color.set( 0xA00000 );
// 				mshStdBox.castShadow = true;
// 				mshStdBox.receiveShadow = true;
// 				mshStdBox.position.set( 0, 5, 0 );
// 				mshStdBox.rotation.set( 0, Math.PI / 2.0, 0 );
				
				scene.add( mshStdFloor );
// 				scene.add( mshStdBox );
				
				controls = new THREE.OrbitControls( camera );
				renderer.setPixelRatio( window.devicePixelRatio );
				renderer.setSize( window.innerWidth, window.innerHeight );
				renderer.shadowMap.enabled = true;
				renderer.shadowMap.type = THREE.PCFSoftShadowMap;
				renderer.gammaInput = true;
				renderer.gammaOutput = true;
				document.body.appendChild( renderer.domElement );
				scene.add( new THREE.AmbientLight( "#555555") );//环境光源

			}

			function animate() {
				requestAnimationFrame( animate );
				renderer.render( scene, camera );
			}

		</script>
	</body>
</html>
